interface KHTMLElement {
    /**
     * 插入元素
     * @param tagName 标签名 'div' or '<div>'
     * @param options 参数
     * @returns 当前元素
     */
    insertElement(tagName: string, options?: Tdom_options): KHTMLElement;
    /**
     * 插入元素
     * @param element 子元素
     * @description             element = HTMLElement  => 指定元素对象
     * @description             element = KHTMLElement => 指定元素对象
     * @returns 当前元素对象
     */
    insertElement(element: HTMLElement | KHTMLElement): KHTMLElement;
}
{
    Object.defineProperty(KHTMLElement.prototype, 'insertElement', {
        writable: false,
        configurable: false,
        enumerable: false,
        value: U.F.overloading('DOM-insertTo',
            {
                types: [Etype.string, U.F.argType.optional(Etype.obj)],
                fn: function (this: KHTMLElement, tagName: string, options?: Tdom_options) {
                    const parent_ele = this.ele();
                    if (parent_ele) { parent_ele.appendChild(U.D.createElement(tagName, options).ele()!); }
                    return this;
                }
            },
            {
                types: [Etype.HTMLElement],
                fn: function (this: KHTMLElement, element: HTMLElement) {
                    const parent_ele = this.ele();
                    if (parent_ele) { parent_ele.appendChild(element); }
                    return this;
                }
            },
            {
                types: [Etype.KHTMLElement],
                fn: function (this: KHTMLElement, element: KHTMLElement) {
                    const parent_ele = this.ele();
                    if (parent_ele) {
                        const ele = element.ele();
                        if (ele) { parent_ele.appendChild(ele); }
                    }
                    return this;
                }
            },
        )

    });
}
